package android.serialport.utils;

public class HexUtils {
    public static String toHexString(byte[] data,int offset,int size){
        StringBuilder hexArray = new StringBuilder();
        for (int i = offset; i < size; i++) {
            String hex = Integer.toHexString(data[i] & 0xFF);
            if (hex.length() == 1) {
                hex = '0' + hex;
            }
            hexArray.append(hex).append(" ");
        }
        return hexArray.toString();
    }
}
